<template>
	<view>
		<view class="topst">
			<view class="top">
				<dateselect @change='datachange'></dateselect>
			</view>
			<view class="table">
				<view class="it" style="width: 150rpx;">日期</view>
				<view class="it" style="width: 200rpx;">交易金额</view>
				<view class="it" style="width: 200rpx;">有效金额</view>
				<view class="it" style="width: 200rpx;">佣金</view>
			</view>
		</view>
		<view class="ulist" v-for="(item,index) in List" :key="index" @click="pagedetail(item)">
			<view class="table">
				<view class="it1" style="width: 150rpx;">{{String(item.month).substring(4)}}月</view>
				<view class="it" style="width: 200rpx;"><span>￥</span>{{item.amountOrder}}</view>
				<view class="it" style="width: 200rpx;"><span>￥</span>{{item.amountPay}}</view>
				<view class="it" style="width: 200rpx;">
					<view class="">
						<span>￥</span>{{item.amountIncome}}
					</view>
					<view class="ts" v-if="item.confirm == 0">
						待确认
					</view>
					<view class="ts" style="color: #D1D1D6;" v-else>
						已确认
					</view>
				</view>
			</view>
		</view>
		<view class="" style="height: 100rpx;">
			
		</view>
		<view class="kong" v-if="nolist">
			<view class="">
				<image src="/static/user/k.png" mode=""></image>
				<view class="ts">
					尚无数据
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		customerOrderList
	} from '@/common/http.api.js';
	export default {
		data() {
			return {
				params:{
					pageNum: 1,
					pageSize: 10,
					monthBegin:'',
					monthEnd:'',
				},
				List:[],
				nolist:false
			};
		},
		onLoad() {
			this.getList()
		},
		onReachBottom() {
			this.params.pageNum++
			this.getList()
		},
		methods: {
			getList(){
				customerOrderList(this.params).then(res=>{
					this.List.push(...res.rows)
					let total = Math.ceil(res.total / this.params.pageSize);
					this.nolist = total == 0
				})
			},
			pagedetail(item){
				uni.navigateTo({
					url:`/mypage/proxy/billdetail?month=${item.month}&&confirm=${item.confirm}`
				})
			},
			datachange(e){
				console.log(e);
				this.params.monthBegin = e[0].replace('-',"")
				this.params.monthEnd = e[1].replace('-',"")
				this.params.pageNum = 1
				this.List = []
				this.getList()
			},
		}
	}
</script>

<style lang="scss">
	.kong {
		width: 100%;
		margin: 230rpx auto;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
	
		image {
			width: 228rpx;
			height: 228rpx;
		}
	
		.ts {
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #000000;
			margin-top: 20rpx;
		}
	}
	.topst{
		position: sticky;
		top: 0%;
		.top {
			padding: 20rpx;
			box-sizing: border-box;
			background-color: #ffffff;
		}
		
		.table{
			display: flex;
			background-color: #F6F6F6;
			height: 80rpx;
			align-items: center;
			.it{
				text-align: center;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #000000;
			}
		}
	}
	.ulist{
		.table{
			display: flex;
			align-items: center;
			border-bottom: 1px solid #eee;
			padding: 34rpx 0rpx;
			.it1{
				text-align: center;
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #000000;
			}
			.it{
				text-align: center;
				font-family: 'DINB';
				font-weight: 500;
				font-size: 40rpx;
				color: #000000;
				span{
					font-size: 28rpx;
				}
				.ts{
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 24rpx;
					color: #CE7034;
				}
			}
		}
	}

</style>